package com.ayoka.parenting.ui.coach.sendinvitecode;

import com.ayoka.parenting.R;
import com.ayoka.parenting.bean.ClassroomBean;
import com.ayoka.parenting.bean.CoachInviteCodeBean;
import com.ayoka.parenting.interf.SimpleRequestCallback;
import com.ayoka.parenting.mvp.BasePresenterImpl;
import com.jincp.common.utils.UIUtils;

/**
 * @ProjectName: MVPPlugin.
 * @ClassName: SendInviteCodePresenter.
 * @Description: .
 * @Author: jincp.
 * @CreateDate: 2019/10/10 18:17.
 */
public class SendInviteCodePresenter extends BasePresenterImpl<SendInviteCodeContract.View> implements SendInviteCodeContract.Presenter{

    private SendInviteCodeModel model;

     public SendInviteCodePresenter() {
        model = new SendInviteCodeModel();
     }

    @Override
    public void getInviteCodeData() {
        mView.get().showWaitDialog(UIUtils.getString(R.string.loading));
        model.getInviteCodeData(this, new SimpleRequestCallback<CoachInviteCodeBean>() {
            @Override
            public void onSuccess(CoachInviteCodeBean data) {
                if (!isAttached()) return;
                mView.get().hideWaitDialog();
                mView.get().configInviteCodeData(data);
            }

            @Override
            public void onFailure(int errCode, String errMsg) {
                if (!isAttached()) return;
                mView.get().hideWaitDialog();
                mView.get().showToast(errMsg);
            }
        });
    }
}
